//
// File:	IEntity.hpp
// Author:	Thomas TISSOT-DUPONT
// Login:	<thomas.tissotdupont@free.fr>
//
// Create:	27/01/2010 at 17:30:38
// Purpose:	
//
#ifndef IENTITY_HPP
#define IENTITY_HPP

#include <string>
#include "IRenderable.hpp"
#include "IAnimating.hpp"
#include "Variant.hpp"

enum RenderGroup
{
	RENDERGROUP_NODRAW = 0,		//Don't draw
	RENDERGROUP_UNKNOWN,		//Unknown yet or undefined
	RENDERGROUP_WORLD,			//World
	RENDERGROUP_CHARACTERS,		//Players and mobs
	RENDERGROUP_ITEMS,			//Weapons, powerups, missiles
	RENDERGROUP_EFFECTS,		//Explosions and misc. effects
	RENDERGROUP_MAX,
};

//TODO: create a precache method to preload the entity resources before use (it will avoid short freezes at run-time).
class IEntity
{
public:
	virtual						~IEntity() {}


public:
	virtual void				OnCreate() = 0;
	virtual void				OnDestroy() = 0;
	virtual void				OnCreateDataMap() = 0;

public:
	virtual void				Update() = 0;
	virtual void				Render() = 0;

public:
	virtual IAnimating			*GetAnimating() const = 0;

public:
	virtual void				WriteDataMapVariable(const std::string &, const Variant &) = 0;

/*
public:
	virtual unsigned long		GetServerID() const = 0;
*/

public:
	virtual const std::string	&GetClassname() const = 0;
	virtual void				SetClassname(const std::string &) = 0;

public:
	virtual void				FollowEntity(IEntity *) = 0;
	virtual IEntity				*GetFollowingEntity() const = 0;
	virtual void				SetFollowOffsetX(float) = 0;
	virtual void				SetFollowOffsetY(float) = 0;
	virtual void				SetFollowOffsetCenterX(float) = 0;
	virtual void				SetFollowOffsetCenterY(float) = 0;
	virtual float				GetFollowOffsetX() const = 0;
	virtual float				GetFollowOffsetY() const = 0;

public:
	virtual bool				IsRemoved() const = 0;
	virtual void				Remove() = 0;

public:
	virtual void				SetRenderGroup(RenderGroup) = 0;
	virtual RenderGroup			GetRenderGroup() const = 0;

public:
	virtual void				SetX(float) = 0;
	virtual void				SetY(float) = 0;
	virtual void				SetWidth(float) = 0;
	virtual void				SetHeight(float) = 0;
	virtual void				SetCenterX(float) = 0;
	virtual void				SetCenterY(float) = 0;
	virtual void				SetVelocityX(float) = 0;
	virtual void				SetVelocityY(float) = 0;
	virtual float				GetX() const = 0;
	virtual float				GetY() const = 0;
	virtual float				GetWidth() const = 0;
	virtual float				GetHeight() const = 0;
	virtual float				GetCenterX() const = 0;
	virtual float				GetCenterY() const = 0;
	virtual float				GetVelocityX() const = 0;
	virtual float				GetVelocityY() const = 0;
};

#endif //!IENTITY_HPP
